home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Hardware / Mac OS USB DDK / Mac OS USB DDK 1.4.1 / Examples / USBKeypad / USBKeypad.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-25  |  2.6 KB  |  101 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        USBKeypad.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1999 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12. #ifndef __MacAllyTenKeyH__
  13. #define __MacAllyTenKeyH__
  14.  
  15. #include <Types.h>
  16. #include <Devices.h>
  17. #include <DriverServices.h>
  18. #include <Processes.h>
  19. #include <USB.h>
  20.  
  21. void     PostUSBKeyToMac(UInt16 rawUSBkey);
  22. void    PostADBKeyToMac(UInt16 virtualKeycode, UInt8 state);
  23.  
  24. void    USBDemoKeyIn(UInt32 refcon, void * theData);
  25. void    InitUSBKeyboard(void);
  26. void     KBDHIDNotification(UInt32 devicetype, UInt8 NewHIDData[], UInt8 OldHIDData[]);
  27.  
  28. Boolean    SetBit(UInt8 *bitmapArray, UInt16 index, Boolean value);
  29.  
  30. static     OSStatus    MacAllyTenKeyDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  31. static     OSStatus    MacAllyTenKeyInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  32. static     OSStatus    MacAllyTenKeyFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  33.  
  34. void    InitiateTransaction(USBPB *pb);
  35. void     TransactionCompletionProc(USBPB *pb);
  36.  
  37. void     DriverEntry(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  38.  
  39. void     ProcessInterruptReport(UInt8 hidReport[]);
  40.  
  41. #define kKeyboardRetryCount        3
  42. #define kKeyboardModifierBits    8
  43. #define kKeyboardReportKeys        2
  44. #define    kKeyboardOffsetToKeys    2
  45. #define kKeyboardReportSize        4
  46.  
  47. enum driverstages
  48. {
  49.     kUndefined = 0,
  50.     kFindInterface,
  51.     kConfigureDevice,
  52.     kNewInterfaceRef,
  53.     kConfigureInterface,
  54.     kGetReportDescriptor,
  55.     kFindInterruptPipe,
  56.     kReadInterruptPipe,
  57.     kReturnFromDriver =     0x1000,
  58.     kRetryTransaction =     0x2000,
  59.     kSyncTransaction =         0x4000,
  60.     kCompletionPending =     0x8000
  61. };
  62.  
  63. typedef struct
  64. {
  65.     USBPB                             pb;
  66.     void (*handler)(USBPB             *pb);
  67.  
  68.     USBDeviceRef                    deviceRef;
  69.     USBInterfaceRef                    interfaceRef;
  70.     USBPipeRef                        pipeRef;
  71.     
  72.     USBDeviceDescriptor             deviceDescriptor;
  73.     USBInterfaceDescriptor            interfaceDescriptor;
  74.  
  75.     USBConfigurationDescriptorPtr     pFullConfigDescriptor;
  76.     USBInterfaceDescriptorPtr        pInterfaceDescriptor;
  77.     USBEndPointDescriptorPtr        pEndpointDescriptor;
  78.     
  79.     UInt32                            configurationNumber;
  80.     UInt32                            interfaceNumber;
  81.     UInt32                            interfaceSubClass;
  82.     
  83.     UInt32                            hidDeviceType;
  84.     
  85.     UInt32                            hidReportSize;
  86.     UInt8                            hidReport[8];
  87.     UInt8                            oldHIDReport[8];
  88.     UInt8                            padding[8];
  89.     UInt8                            hidReportDescriptor[256];
  90.     
  91.     Boolean                            sendRawReportFlag;
  92.     Boolean                            hidEmulationInit;
  93.     
  94.     UInt32                            interruptRefcon;
  95.     
  96.     SInt32                             retryCount;
  97.     SInt32                            delayLevel;
  98.     SInt32                            transDepth;
  99. } usbKeyPadPBStruct;
  100.  
  101. #endif //__MacAllyTenKeyH__